<?php

namespace App\Models\Shop;

use Illuminate\Database\Eloquent\Model;

class Mark extends Model
{
    protected $guarded = [];

    //一个品牌有多个商品
    public function goods()
    {
        return $this->hasMany('App\Models\Shop\Good');
    }


    /**
     * 检查当前品牌是否有商品
     */
    static function check_goods($id)
    {
        $mark = self::with('goods')->find($id);
        if ($mark->goods->isEmpty()) {
            return true;
        }
        return false;
    }
}
